local zhulan = fk.CreateSkill{
    name = "gai__zhulan",
    tags = { Skill.Limited },
  }
  
  Fk:loadTranslationTable{
    ["gai__zhulan"] = "助澜",
    [":gai__zhulan"] = "限定技，当一名其他角色受到伤害时，你可以弃置一张牌令此伤害+1；若伤害来源与其势力相同，则本回合结束时，此技能视为未发动过。",
  
    ["@zhulan-turn"] = "助澜",

    ["#gai__zhulan-invoke"] = "助澜：你可以弃置一张牌，令 %dest 受到的伤害+1",
  }
  
  local H = require "packages/hegemony/util"
  

  
  zhulan:addEffect(fk.DamageInflicted, {
    anim_type = "offensive",
    can_trigger = function(self, event, target, player, data)
      return target ~= player and player:hasSkill(zhulan.name) and
        player:usedSkillTimes(zhulan.name, Player.HistoryGame) == 0 and
        not player:isNude()
    end,
    on_cost = function(self, event, target, player, data)
      local room = player.room
      local card = room:askToDiscard(player, {
        min_num = 1,
        max_num = 1,
        include_equip = true,
        skill_name = zhulan.name,
        cancelable = true,
        prompt = "#gai__zhulan-invoke::" .. target.id,
        skip = true,
      })
      if #card > 0 then
        event:setCostData(self, {tos = {target}, cards = card})
        return true
      end
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      room:throwCard(event:getCostData(self).cards, zhulan.name, player, player)
      data:changeDamage(1)
      
      -- 如果伤害来源与受伤角色势力相同，则标记需要重置技能
      if data.from and H.compareKingdomWith(data.from, target, false) then
        room:setPlayerMark(player, "@zhulan-turn", 1)
      end
    end,
  })
  
  -- 添加回合结束效果，用于重置技能
  zhulan:addEffect(fk.TurnEnd, {
    can_trigger = function(self, event, target, player, data)
      return player:getMark("@zhulan-turn") > 0
    end,
    on_use = function(self, event, target, player, data)
      -- 重置技能使用次数
      player:setSkillUseHistory("gai__zhulan", 0, Player.HistoryGame)
    end,
  })
  
  return zhulan